package com.huawei;

/**
 * Created by Z-hong on 2024/7/22.
 */

import java.util.*;

public class HJ64 {
    static class Page {
        int i = 0;
        int page[];
        int max;

        public Page(int max) {
            this.max = max;
            int temp[] = new int[4];
            if (max < 4) {
                for (int i = 0; i < max; i++) {
                    temp[i] = i + 1;
                }
            } else {
                for (int i = 0; i < 4; i++) {
                    temp[i] = i + 1;
                }
            }
            this.page = temp;
        }

        public void up() {
            if (i == 0 && page[0] == 1) {
                if (max > 4) {
                    i = 3;
                    int temp = max;
                    for (int j = 3; j >= 0; j--) {
                        page[j] = temp;
                        temp--;
                    }
                }else{
                    i=max-1;
                }
            } else if (i == 0) {
                for (int j = 0; j < 4; j++) {
                    if (page[j] == 0) continue;
                    page[j] = page[j] - 1;
                }
            } else {
                i--;
            }
        }

        public void down() {
            if (page[i] == max) {
                i = 0;
                if (max > 4) {
                    for (int j = 0; j < 4; j++) {
                        page[j] = j + 1;
                    }
                }
            } else if (i == 3) {
                for (int j = 0; j < 4; j++) {
                    page[j] = page[j] + 1;
                }
            } else {
                i++;
            }
        }

        public void print() {
            for (int j = 0; j < 4; j++) {
                if (page[j] == 0) continue;
                System.out.print(page[j] + " ");
            }
            System.out.println();
            System.out.println(page[i]);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = sc.nextInt();
        String str = sc.next();
        char[] charArray = str.toCharArray();
        Page page = new Page(count);
        for (int i = 0; i < charArray.length; i++) {
            if (charArray[i] == 'U') {
                page.up();
            } else page.down();
        }
        page.print();
    }
}
